package com.haixiaoke.saas.house.service.impl;

import com.haixiaoke.saas.common.utils.DateUtils;
import com.haixiaoke.saas.house.domain.House;
import com.haixiaoke.saas.house.domain.SubHouse;
import com.haixiaoke.saas.house.mapper.SubHouseMapper;
import com.haixiaoke.saas.house.service.ISubHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 房屋子房间Service业务层处理
 *
 * @author panda
 * @date 2023-10-25
 */
@Service
public class SubHouseServiceImpl implements ISubHouseService {
    @Autowired
    private SubHouseMapper subordinateHouseMapper;

    /**
     * 查询房屋子房间
     *
     * @param subordinateHouseId 房屋子房间主键
     * @return 房屋子房间
     */
    @Override
    public SubHouse selectSubordinateHouseBySubordinateHouseId(String subordinateHouseId) {
        return subordinateHouseMapper.selectSubordinateHouseBySubordinateHouseId(subordinateHouseId);
    }

    /**
     * 查询房屋子房间列表
     *
     * @param subordinateHouse 房屋子房间
     * @return 房屋子房间
     */
    @Override
    public List<SubHouse> selectSubordinateHouseList(SubHouse subordinateHouse) {
        return subordinateHouseMapper.selectSubordinateHouseList(subordinateHouse);
    }

    /**
     * 新增房屋子房间
     *
     * @param subordinateHouse 房屋子房间
     * @return 结果
     */
    @Override
    public int insertSubordinateHouse(SubHouse subordinateHouse) {
        subordinateHouse.setCreateTime(DateUtils.getNowDate());
        return subordinateHouseMapper.insertSubordinateHouse(subordinateHouse);
    }

    /**
     * 修改房屋子房间
     *
     * @param subordinateHouse 房屋子房间
     * @return 结果
     */
    @Override
    public int updateSubordinateHouse(SubHouse subordinateHouse) {
        subordinateHouse.setUpdateTime(DateUtils.getNowDate());
        return subordinateHouseMapper.updateSubordinateHouse(subordinateHouse);
    }

    /**
     * 批量删除房屋子房间
     *
     * @param subordinateHouseIds 需要删除的房屋子房间主键
     * @return 结果
     */
    @Override
    public int deleteSubordinateHouseBySubordinateHouseIds(String[] subordinateHouseIds) {
        return subordinateHouseMapper.deleteSubordinateHouseBySubordinateHouseIds(subordinateHouseIds);
    }

    /**
     * 删除房屋子房间信息
     *
     * @param subordinateHouseId 房屋子房间主键
     * @return 结果
     */
    @Override
    public int deleteSubordinateHouseBySubordinateHouseId(String subordinateHouseId) {
        return subordinateHouseMapper.deleteSubordinateHouseBySubordinateHouseId(subordinateHouseId);
    }

    @Override
    public int insertBatchSubordinateHouse(List<SubHouse> subordinateHouseList) {
        return subordinateHouseMapper.insertBatchSubordinateHouse(subordinateHouseList);
    }

    @Override
    public int selectHouseByHouseNumber() {
        return subordinateHouseMapper.selectHouseByHouseNumber();
    }

    @Override
    public int selectHouseCountByHouseState(String houseState, String houseLeaseState, String houseMaintainState, String onlineRentalType, String tenantId) {
        return subordinateHouseMapper.selectHouseCountByHouseState(houseState, houseLeaseState, houseMaintainState, onlineRentalType,tenantId);
    }

    @Override
    public int updateBatchSubordinateHouse(List<SubHouse> subordinateHouseList) {
        return subordinateHouseMapper.updateBatchSubordinateHouse(subordinateHouseList);
    }

    @Override
    public List<SubHouse> selectSubordinateHouseByHouseId(String houseId) {
        return subordinateHouseMapper.selectSubordinateHouseByHouseId(houseId);
    }

    @Override
    public int softDeleteSubordinateHouseByHouseIds(String houseId) {
        return subordinateHouseMapper.softDeleteSubordinateHouseByHouseIds(houseId);
    }


    @Override
    public List<House> selectSubHouseListConvertHouse(House house) {
        return subordinateHouseMapper.selectSubHouseListConvertHouse(house);
    }
}
